<!-- todo: styling, css etc. - disposition according to project lib conventions -->
<!-- todo: further componentization -->
<div class="JobResults-panelHeader">
    <div class="JobResults-panelHeaderText"> {{:: vm.strings.get('details.HEADER')}}</div>
    <!-- LEFT PANE HEADER ACTIONS -->
    <div class="JobResults-panelHeaderButtonActions">
        <!-- RELAUNCH ACTION -->
        <at-relaunch job="vm.job"></at-relaunch>

        <!-- CANCEL ACTION -->
        <button
            class="List-actionButton List-actionButton--delete"
            data-placement="top"
            ng-click="vm.cancelJob()"
            ng-show="vm.status.value === 'Pending' ||
                     vm.status.value === 'Waiting' ||
                     vm.status.value === 'Running'"
            aw-tool-tip="{{:: vm.strings.get('tooltips.CANCEL') }}"
            data-original-title=""
            title="">
            <i class="fa fa-minus-circle"></i>
        </button>

        <!-- DELETE ACTION -->
        <button
            class="List-actionButton List-actionButton--delete"
            data-placement="top"
            ng-click="vm.deleteJob()"
            ng-show="vm.canDelete && (
                   vm.status.value === 'New' ||
                   vm.status.value === 'Successful' ||
                   vm.status.value === 'Failed' ||
                   vm.status.value === 'Error' ||
                   vm.status.value === 'Canceled')"
            aw-tool-tip="{{:: vm.strings.get('tooltips.DELETE') }}"
            data-original-title=""
            title="">
            <i class="fa fa-trash-o"></i>
        </button>
    </div>
</div>

<!-- LEFT PANE DETAILS GROUP -->
<!-- STATUS DETAIL -->
<div class="JobResults-resultRow">
    <label class="JobResults-resultRowLabel">{{ vm.status.label }}</label>
    <div class="JobResults-resultRowText">
        <span><i class="JobResults-statusResultIcon {{ vm.status.icon }}"></i></span>
        <span>{{ vm.status.value }}</span>
    </div>
</div>

<!-- EXPLANATION DETAIL -->
<div class="JobResults-resultRow" ng-show="vm.jobExplanation">
    <label class="JobResults-resultRowLabel">{{ vm.jobExplanation.label }}</label>
    <div class="JobResults-resultRowText"
            ng-show="!vm.jobExplanation.showMore">
        {{ vm.jobExplanation.less }}
        <span ng-show="vm.jobExplanation.hasMoreToShow">...</span>
        <span ng-show="vm.jobExplanation.hasMoreToShow"
                class="JobResults-seeMoreLess"
                ng-click="vm.jobExplanation.showMore = true">
            {{:: vm.strings.get('details.SHOW_MORE') }}
        </span>
    </div>
    <div class="JobResults-resultRowText"
            ng-show="vm.jobExplanation.showMore">
        {{ vm.jobExplanation.more }}
        <span class="JobResults-seeMoreLess"
                ng-click="vm.jobExplanation.showMore = false">
            {{:: vm.strings.get('details.SHOW_LESS') }}
        </span>
    </div>
</div>

<!-- LICENSE ERROR DETAIL -->
<div class="JobResults-resultRow" ng-show="vm.licenseError">
    <label class="JobResults-resultRowLabel">{{ vm.licenseError.label }}</label>
    <div class="JobResults-resultRowText">
        {{ vm.licenseError.value }}
    </div>
</div>

<!-- HOST LIMIT ERROR DETAIL -->
<div class="JobResults-resultRow" ng-show="vm.hostLimitError">
    <label class="JobResults-resultRowLabel">
        {{ vm.hostLimitError.label }}
        <a id="awp-hostLimitError"
            href=""
            aw-pop-over="{{ vm.hostLimitError.tooltip }}"
            data-placement="top"
            data-container="body"
            class="help-link"
            title="{{ vm.hostLimitError.label }}"
            tabindex="-1">
                <i class="fa fa-question-circle"></i>
        </a>
    </label>
    <div class="JobResults-resultRowText">
        {{ vm.hostLimitError.value }}
    </div>
</div>

<!-- START TIME DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.started">
    <label class="JobResults-resultRowLabel">{{ vm.started.label }}</label>
    <div class="JobResults-resultRowText">
        {{ vm.started.value }}
    </div>
</div>

<!-- FINISHED TIME DETAIL -->
<div class="JobResults-resultRow" ng-show="vm.started">
    <label class="JobResults-resultRowLabel">{{ vm.finished.label }}</label>
    <div class="JobResults-resultRowText">
        {{ vm.finished.value }}
    </div>
</div>

<!-- module args -->
<div class="JobResults-resultRow" ng-if="vm.moduleArgs">
    <label class="JobResults-resultRowLabel">{{ vm.moduleArgs.label }}</label>
    <div class="JobResults-resultRowText">{{ vm.moduleArgs.value }}</div>
</div>

<!-- RESULTS TRACEBACK DETAIL -->
<div class="JobResults-resultRow" ng-show="vm.resultTraceback">
    <label class="JobResults-resultRowLabel">{{ vm.resultTraceback.label }}</label>
    <div class="JobResults-resultRowText"
            ng-show="!vm.resultTraceback.showMore">
        {{ vm.resultTraceback.less }}
        <span ng-show="vm.resultTraceback.hasMoreToShow">...</span>
        <span ng-show="vm.resultTraceback.hasMoreToShow"
                class="JobResults-seeMoreLess"
                ng-click="vm.resultTraceback.showMore = true">
            {{:: vm.strings.get('details.SHOW_MORE') }}
        </span>
    </div>
    <div class="JobResults-resultRowText"
            ng-show="vm.resultTraceback.showMore">
        {{ vm.resultTraceback.more }}
        <span class="JobResults-seeMoreLess"
                ng-click="vm.resultTraceback.showMore = false">
            {{:: vm.strings.get('details.SHOW_LESS') }}
        </span>
    </div>
</div>

<!-- TEMPLATE DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.jobTemplate">
    <label class="JobResults-resultRowLabel">{{ vm.jobTemplate.label }}</label>
    <div class="JobResults-resultRowText">
        <a href="{{ vm.jobTemplate.link }}"
            aw-tool-tip="{{ vm.jobTemplate.tooltip }}"
            data-placement="top"
            data-tip-watch="vm.jobTemplate.tooltip">
            {{ vm.jobTemplate.value }}
        </a>

        <a href="{{ vm.sourceWorkflowJob.link }}"
            ng-if="vm.sourceWorkflowJob"
            aw-tool-tip="{{ vm.sourceWorkflowJob.tooltip }}" data-placement="top">
            <i class="WorkflowBadge"> W</i>
        </a>
    </div>
</div>

<!-- JOB TYPE DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.jobType">
    <label class="JobResults-resultRowLabel">{{ vm.jobType.label }}</label>
    <div class="JobResults-resultRowText">{{ vm.jobType.value }}</div>
</div>

<!-- SLICE JOB DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.sliceJobDetails">
    <label class="JobResults-resultRowLabel">{{ vm.sliceJobDetails.label }}</label>
    <div class="JobResults-resultRowText">{{ vm.sliceJobDetails.offset }}</div>
</div>

<!-- LAUNCHED BY DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.launchedBy">
    <label class="JobResults-resultRowLabel">{{ vm.launchedBy.label }}</label>
    <div ng-if="vm.launchedBy.link" class="JobResults-resultRowText">
        <a href="{{ vm.launchedBy.link }}" aw-tool-tip="{{ vm.launchedBy.tooltip }}" data-placement="top">
            {{ vm.launchedBy.value }}
        </a>
    </div>
    <div ng-if="!vm.launchedBy.link" class="jobResults-resultRowText">
        {{ vm.launchedBy.value }}
    </div>
</div>

<!-- INVENTORY DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.inventory">
    <label class="JobResults-resultRowLabel">{{ vm.inventory.label }}</label>
    <div class="JobResults-resultRowText">
        <a href="{{ vm.inventory.link }}" aw-tool-tip="{{ vm.inventory.tooltip }}" data-placement="top">
            {{ vm.inventory.value }}
        </a>
    </div>
</div>

<!-- PROJECT DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.project">
    <label class="JobResults-resultRowLabel">{{ vm.project.label }}</label>
    <div class="JobResults-resultRowText">
        <a href="{{ vm.projectUpdate.link }}"
            ng-if="vm.projectUpdate"
            aw-tool-tip="{{ vm.projectUpdate.tooltip }}"
            data-placement="top">
            <i ng-if="vm.projectStatus" class="JobResults-statusResultIcon fa icon-job-{{ vm.projectStatus }}"></i>
        </a>
        <a href="{{ vm.project.link }}"
            aw-tool-tip="{{ vm.project.tooltip }}"
            data-placement="top">
            {{ vm.project.value }}
        </a>
    </div>
</div>

<!-- INVENTORY SCM DETAIL -->
<div class="JobResults-resultRow" ng-if="!vm.project && vm.inventoryScm">
    <label class="JobResults-resultRowLabel">{{ vm.inventoryScm.label }}</label>
    <div class="JobResults-resultRowText">
        <span>
            <a href="{{ vm.inventoryScm.jobLink }}"
                aw-tool-tip="{{ vm.inventoryScm.jobTooltip }}"
                data-placement="top">
                <i class="JobResults-statusResultIcon {{ vm.inventoryScm.icon }}"></i>
            </a>
        </span>
        <span>
            <a href="{{ vm.inventoryScm.link }}"
                aw-tool-tip="{{ vm.inventoryScm.tooltip }}"
                data-placement="top">
                {{ vm.inventoryScm.value }}
            </a>
        </span>
    </div>
</div>

<!-- REVISION DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.scmRevision">
    <label class="JobResults-resultRowLabel">{{ vm.scmRevision.label }}</label>
    <at-truncate string="{{ vm.scmRevision.value }}" maxLength="7" class="JobResults-resultRowText"></at-truncate>
</div>

<!-- PLAYBOOK DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.playbook">
    <label class="JobResults-resultRowLabel">{{ vm.playbook.label }}</label>
    <div class="JobResults-resultRowText">{{ vm.playbook.value }}</div>
</div>

<!-- CREDENTIAL DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.credentials">
    <label class="JobResults-resultRowLabel">{{ vm.credentials.label }}</label>
    <div class="JobResults-resultRowText">
        <at-tag
            ng-repeat="credential in vm.credentials.value"
            tag="credential.value"
            icon="{{ credential.icon }}"
            link="{{ credential.link }}"
            aw-tool-tip="{{ credential.tooltip }}"
            data-placement="top"
            data-tip-watch="credential.tooltip">
        </at-tag>
    </div>
</div>

<!-- INVENTORY SOURCE DETAIL -->
<div class="JobResults-resultRow" ng-show="vm.inventorySource">
    <label class="JobResults-resultRowLabel">{{ vm.inventorySource.label }}</label>
    <div class="JobResults-resultRowText">
        {{ vm.inventorySource.value }}
    </div>
</div>

<!-- OVERWRITE DETAIL -->
<div class="JobResults-resultRow" ng-show="vm.overwrite">
    <label class="JobResults-resultRowLabel">{{ vm.overwrite.label }}</label>
    <div class="JobResults-resultRowText">
        {{ vm.overwrite.value }}
    </div>
</div>

<!-- OVERWRITE VARS DETAIL -->
<div class="JobResults-resultRow" ng-show="vm.overwriteVars">
    <label class="JobResults-resultRowLabel">{{ vm.overwriteVars.label }}</label>
    <div class="JobResults-resultRowText">
        {{ vm.overwriteVars.value }}
    </div>
</div>

<!-- FORKS DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.forks">
    <label class="JobResults-resultRowLabel">{{ vm.forks.label }}</label>
    <div class="JobResults-resultRowText">{{ vm.forks.value }}</div>
</div>

<!-- LIMIT DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.limit">
    <label class="JobResults-resultRowLabel">{{ vm.limit.label }}</label>
    <div class="JobResults-resultRowText">{{ vm.limit.value }}</div>
</div>

<!-- VERBOSITY DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.verbosity">
    <label class="JobResults-resultRowLabel">{{ vm.verbosity.label }}</label>
    <div class="JobResults-resultRowText">{{ vm.verbosity.value }}</div>
</div>

<!-- ENVIRONMENT DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.environment">
    <label class="JobResults-resultRowLabel">{{ vm.environment.label }}</label>
    <div class="JobResults-resultRowText">{{ vm.environment.value }}</div>
</div>

<!-- EXECUTION Node DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.executionNode">
  <label class="JobResults-resultRowLabel">{{ vm.executionNode.label }}</label>
  <div class="JobResults-resultRowText">{{ vm.executionNode.value }}</div>
</div>

<!-- IG DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.instanceGroup">
    <label class="JobResults-resultRowLabel">{{ vm.instanceGroup.label }}</label>
    <div class="JobResults-resultRowText JobResults-resultRowText--instanceGroup">
        <a href="{{ vm.instanceGroup.link }}">
            {{ vm.instanceGroup.value }}
        </a>
        <span class="JobResults-isolatedBadge" ng-if="vm.instanceGroup.isolated">
            {{ vm.instanceGroup.isolated }}
        </span>
    </div>
</div>

<!-- SOURCE WORKFLOW JOB DETAIL -->
<div class="JobResults-resultRow" ng-if="vm.sourceWorkflowJob">
    <label class="JobResults-resultRowLabel">{{ vm.sourceWorkflowJob.label }}</label>
    <div class="JobResults-resultRowText">
        <a href="{{ vm.sourceWorkflowJob.link }}"
        aw-tool-tip="{{ vm.sourceWorkflowJob.tooltip }}"
        data-placement="top">
        {{ vm.sourceWorkflowJob.value }}
        </a>
    </div>
</div>

<!-- EXTRA VARIABLES DETAIL -->
<at-code-mirror
    class="JobResults-resultRow"
    ng-if="vm.extraVars"
    variables="{{ vm.extraVars.value }}"
    tooltip="{{ vm.extraVars.tooltip }}"
    label="{{ vm.extraVars.label }}"
    name="{{ vm.extraVars.name }}"
    disabled="{{ vm.extraVars.disabled }}">
</at-code-mirror>

<!-- ARTIFACTS DETAIL -->
<at-code-mirror
    class="JobResults-resultRow"
    ng-if="vm.artifacts"
    variables="{{ vm.artifacts.value }}"
    tooltip="{{ vm.artifacts.tooltip }}"
    label="{{ vm.artifacts.label }}"
    name="{{ vm.artifacts.name }}"
    disabled="{{ vm.artifacts.disabled }}">
</at-code-mirror>

<!-- LABELS DETAIL -->
<div class="JobResults-resultRow" ng-show="vm.labels">
    <div class="JobResults-resultRow">
        <a class="JobResults-resultRowLabel JobResults-resultRowLabel--fullWidth"
            ng-show="vm.labels.more"
            href=""
            ng-click="vm.toggleLabels()">
            <span>{{ vm.labels.label }}</span>
            <i class="JobResults-expandArrow fa fa-caret-right"></i>
        </a>
        <a class="JobResults-resultRowLabel JobResults-resultRowLabel--fullWidth"
            ng-show="!vm.labels.more"
            href=""
            ng-click="vm.toggleLabels()">
            <span>{{ vm.labels.label }}</span>
            <i class="JobResults-expandArrow fa fa-caret-down"></i>
        </a>
    </div>
    <div id="job-results-labels">
        <div ng-show="vm.labels.truncate" class="LabelList JobResults-resultRowText JobResults-resultRowText--fullWidth">
            <div ng-repeat="label in vm.labels.value | limitTo: vm.labels.truncateLength" class="LabelList-tagContainer">
                <div class="LabelList-tag"><div class="LabelList-name">{{ label }}</div></div>
            </div>
            <span ng-show="vm.labels.hasMoreToShow"
                class="JobResults-seeMoreLess"
                ng-click="vm.showLabels()">
                {{:: vm.strings.get('details.SHOW_MORE') }}
            </span>
        </div>
        <div ng-show="!vm.labels.truncate" class="LabelList JobResults-resultRowText JobResults-resultRowText--fullWidth">
            <div ng-repeat="label in vm.labels.value" class="LabelList-tagContainer">
                <div class="LabelList-tag"><div class="LabelList-name">{{ label }}</div></div>
            </div>
            <span ng-show="vm.labels.hasMoreToShow"
                class="JobResults-seeMoreLess"
                ng-click="vm.showLabels()">
                {{:: vm.strings.get('details.SHOW_LESS') }}
            </span>
        </div>
    </div>
</div>

<!-- TAGS DETAIL -->
<div class="JobResults-resultRow" ng-show="vm.jobTags">
    <div class="JobResults-resultRow">
        <a class="JobResults-resultRowLabel JobResults-resultRowLabel--fullWidth"
            ng-show="vm.jobTags.more"
            href=""
            ng-click="vm.toggleJobTags()">
            <span>{{ vm.jobTags.label }}</span>
            <i class="JobResults-expandArrow fa fa-caret-right"></i>
        </a>
        <a class="JobResults-resultRowLabel JobResults-resultRowLabel--fullWidth"
            ng-show="!vm.jobTags.more"
            href=""
            ng-click="vm.toggleJobTags()">
            <span>{{ vm.jobTags.label }}</span>
            <i class="JobResults-expandArrow fa fa-caret-down"></i>
        </a>
    </div>
    <div id="job-results-job-tags" class="LabelList JobResults-resultRowText JobResults-resultRowText--fullWidth">
        <div ng-repeat="tag in vm.jobTags.value" class="LabelList-tagContainer">
            <div class="LabelList-tag"><div class="LabelList-name">{{ tag }}</div></div>
        </div>
    </div>
</div>

<!-- SKIP TAGS DETAIL -->
<div class="JobResults-resultRow" ng-show="vm.skipTags">
    <div class="JobResults-resultRow">
        <a class="JobResults-resultRowLabel JobResults-resultRowLabel--fullWidth"
            ng-show="vm.skipTags.more"
            href=""
            ng-click="vm.toggleSkipTags()">
            <span>{{ vm.skipTags.label }}</span>
            <i class="JobResults-expandArrow fa fa-caret-right"></i>
        </a>
        <a class="JobResults-resultRowLabel JobResults-resultRowLabel--fullWidth"
            ng-show="!vm.skipTags.more"
            href=""
            ng-click="vm.toggleSkipTags()">
            <span>{{ vm.skipTags.label }}</span>
            <i class="JobResults-expandArrow fa fa-caret-down"></i>
        </a>
    </div>
    <div id="job-results-skip-tags" class="LabelList JobResults-resultRowText JobResults-resultRowText--fullWidth">
        <div ng-repeat="tag in vm.skipTags.value" class="LabelList-tagContainer">
            <div class="LabelList-tag"><div class="LabelList-name">{{ tag }}</div></div>
        </div>
    </div>
</div>
